import request from '@/config/axios'

import { BaseModel } from '@/api/common/baseModel'

export interface Model extends BaseModel {
  remark: string
  status: string

  businessHours: string

  cart: string

  areaId: string

  address: string

  obs: string

  nonBusinessHoursShow: string

  refund: string

  province: string

  city: string

  region: string

  detailAddress: string

  lat: string

  lng: string

  deliveryArea: string

  appIdWxpay: string

  mchId: string

  mchKey: string

  keyFiles: string

  appIdAlipay: string

  merchantPrivateKey: string

  alipayFiles: string
}

export interface MerchantPageReqVO extends PageParam {
  name?: string
  remark?: string
}

export interface MerchantExportReqVO extends BaseModel {
  remark?: string
}

// 查询列表支付商户
export const getPage = (params: MerchantPageReqVO) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/shop/shop/page.json',
    params
  })
}

export const arr = (params: MerchantPageReqVO | null) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/shop/shop/arr.json',
    params
  })
}

// 查询详情支付商户
export const getById = (id: string) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/shop/shop/getById.json?id=' + id
  })
}

// 根据商户名称搜 索商户列表
export const getMerchantListByName = (name?: string) => {
  return request.get({
    url: '/userCenter/shop/shop/arr.json',
    params: {
      name: name
    }
  })
}

// 修改支付商户
export const update = (data: Model) => {
  return request.get({
    url: '/userCenter/shop/shop/update.json',
    params: {
      ...data
    }
  })
}

// 删除支付商户
export const del = (id: string) => {
  return request.delete({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/shop/shop/del.json?id=' + id
  })
}
